package com.google.gwt.gwtpages.client.page;

import com.google.gwt.gwtpages.client.page.loader.GWTPagesLoader;
import com.google.gwt.gwtpages.client.page.parameters.PageParameters;


/**
 * Container class for page-related information related to a single page request
 * that is persisted in the page stack. The
 * {@link GWTPagesLoader#keepInStack(GWTPage, PageParameters)} is used to
 * determine if the page should be kept in the page stack even after another
 * page is requested.
 * 
 * @author Joe Hudson
 */
public class PageStackItem {

	private GWTPage pageData;
	private PageParameters parameters;
	private boolean keepInStack;

	public PageStackItem(GWTPage pageData, PageParameters parameters,
			boolean keepInStack) {
		this.pageData = pageData;
		this.parameters = parameters;
	}

	/**
	 * Return the {@link GWTPage} containing all of the associated page
	 * data
	 */
	public GWTPage getPageData() {
		return pageData;
	}

	/**
	 * Return the {@link PageParameters} for the specific page request
	 */
	public PageParameters getParameters() {
		return parameters;
	}

	/**
	 * Return true if this page should be kept in the page stack and false if
	 * not. See {@link GWTPages#getPageStack()}
	 */
	public boolean shouldKeepInStack() {
		return keepInStack;
	}
}